using System.Data;
using ET;
namespace DAL
{
    public class Sector_DAL
    {
        private static readonly clsConnect cls = new clsConnect();
        #region Getdata
        public DataTable BindGirdSector(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Sector_Search");
        }
        public DataTable BindGirdSectorDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Sector_ID", id);
            return cls.GetData("sp_tb_Sector_Detail");
        }
        #endregion

        #region Insert
        public bool InsertSector(Sector_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Sector_Alias", data.Sector_Alias);
            cls.AddParameter("@Sector_Name", data.Sector_Name);
            cls.AddParameter("@Sector_Note", data.Sector_Note);
            cls.AddParameter("@Sector_User_Add", data.Sector_User_Add);
            cls.AddParameter("@Sector_Date_Add", data.Sector_Date_Add);
            cls.AddParameter("@Sector_Computer_Add", data.Sector_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Sector_Insert");
        }
        #endregion

        #region Update
        public bool UpdateSector(Sector_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Sector_ID", data.Sector_ID);
            cls.AddParameter("@Sector_Alias", data.Sector_Alias);
            cls.AddParameter("@Sector_Name", data.Sector_Name);
            cls.AddParameter("@Sector_Note", data.Sector_Note);
            cls.AddParameter("@Sector_User_Modify", data.Sector_User_Modify);
            cls.AddParameter("@Sector_Date_Modify", data.Sector_Date_Modify);
            cls.AddParameter("@Sector_Computer_Modify", data.Sector_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Sector_Update");
        }
        #endregion

        #region Delete
        public bool DeleteSector(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Sector_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Sector_Delete");
        }
        #endregion
    }
}